//
//  WCProjectSearchField.m
//  WabbitCode
//
//  Created by William Towe on 4/16/09.
//  Copyright 2009 Revolution Software. All rights reserved.
//

#import "WCProjectSearchField.h"
#import "WCProject.h"
#import "WCMacros.h"


@implementation WCProjectSearchField
- (id)initWithFrame:(NSRect)rect {
	if (!(self = [super initWithFrame:rect]))
		return nil;
	
	[[self cell] setSendsSearchStringImmediately:YES];
	[self setAutoresizingMask:NSViewWidthSizable];
	[self setAction:@selector(searchAction:)];
	
	return self;
}

- (void)keyDown:(NSEvent *)event {
	NSLog(@"keyDown");
	switch ([event keyCode]) {
		case kKeyCodeTab:
			if ([event modifierFlags] & NSShiftKeyMask)
				[[[[self window] windowController] document] cycleToPreviousFirstResponder];
			else
				[[[[self window] windowController] document] cycleToNextFirstResponder];
			return;
		default:
			break;
	}
	[super keyDown:event];
}
@end
